import 'package:cbec_app/components/base/base_image.dart';
import 'package:cbec_app/components/base/base_interactive.dart';
import 'package:cbec_app/components/common/common_style.dart';
import 'package:cbec_app/routes/routes.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../pages/classify/binding/brand_detail_binding.dart';
import '../../pages/classify/view/brand_detail.dart';

class LotteryResultListItem extends StatefulWidget {
  ///品牌item
  final Map<String, dynamic> info;
  const LotteryResultListItem({super.key, required this.info});

  @override
  State<StatefulWidget> createState() {
    return _LotteryResultListItemState();
  }
}

class _LotteryResultListItemState extends State<LotteryResultListItem> {
  @override
  Widget build(BuildContext context) {
    return BaseInteractive(
      onClick: () {
        final id = widget.info['id'];
        Get.to(
          () => BrandDetail(flag: id), // 使用函数懒加载页面实例
          routeName: '${Routes.brandDtail}?unique=${DateTime.now().millisecondsSinceEpoch}',
          arguments: {"id": id}, // 传递其它参数
          binding: BrandDetailBinding(flag: id), // 将 tag 参数传递给绑定类
        );
      },
      childWidget: Padding(
        padding: EdgeInsets.only(bottom: 20.h),
        child: Row(
          children: [
            BaseImage(
              url: widget.info['image'],
              width: 40,
              height: 40,
              borderRadius: const BorderRadius.all(Radius.circular(40)),
            ),
            Padding(
              padding: EdgeInsets.only(left: 10.w),
              child: Text(
                widget.info['brandName'],
                style: setTextStyle(12, FontWeight.w300, Color(0xff3d3d3d)),
              ),
            )
          ],
        ),
      ),
    );
  }
}
